package com.roncoo.education.course.service.api.auth.biz;

import com.roncoo.education.course.service.dao.CourseRateDao;
import com.roncoo.education.course.service.dao.impl.mapper.entity.CourseRate;
import com.roncoo.education.util.base.BaseBiz;
import com.roncoo.education.util.base.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class AuthApiCourseRateBiz extends BaseBiz {

    @Autowired
    private CourseRateDao courseRateDao;

    public int save(CourseRate courseRate){
        int save = courseRateDao.save(courseRate);
        return save;
    }

    public int delete(Long courseRateId){
        int i = courseRateDao.deleteById(courseRateId);
        return i;
    }

    public Page<CourseRate> page(Integer pageCurrent,Integer pageSize,Long userNo){
        com.baomidou.mybatisplus.extension.plugins.pagination.Page<CourseRate> page = courseRateDao.page(pageCurrent, pageSize, userNo);
        Page<CourseRate> courseRatePage = new Page<>((int)page.getTotal(),(int)page.getPages(), (int)page.getCurrent(),(int) page.getSize(), page.getRecords());
        return courseRatePage;
    }
}
